package com.back_end.mysql.indata.entity;

import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@Data
@Entity
@Table(catalog = "indata",schema = "indata",
        indexes = {@Index(name = "folderIdIndex",columnList = "folderId")},
        uniqueConstraints = {@UniqueConstraint(name = "upConstraint",columnNames = {"userId","paperId"})})
@EntityListeners(AuditingEntityListener.class)
public class Collection {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long collectionId;
    Long userId;
    Long paperId;
    @Column(updatable = false)
    @CreatedDate
    Date date;
    Long folderId;
}
